1. Field of the Invention
The present invention relates to the use of database tables in computers. More particularly, the invention concerns an apparatus, article of manufacture, and process for loading or reorganizing a data structure and concurrently forming a full or incremental image copy ("backup copy") of the data structure. Such data structures may comprise, for example, tables and/or indices. The invention also facilitates recovery of lost or damaged data structures from full or incremental image copies.
2. Description of Related Art
Database applications constitute one of the most popular applications of computers today. Engineers have designed may different systems and programs to store, query, and modify information stored in database tables. Intricate manipulation of table data is performed using a database language such as "SQL". Higher level operations are typically achieved by executing various high level database commands, in a database system language, such as the "DB2" product of International Business Machines Corp. Some of these high level operations include "Load " and "Image Copy" operations, for example.
Typically, a database management system performs a "Load" operation to compile data from various sources, and ultimately assemble the data into a new or existing table. An "Image Copy" operation creates a backup copy (an "image copy") of a loaded table. In systems such as DB2.TM. systems, an Image Copy operation is typically performed immediately after a table is loaded to create an image copy of a table. This Image Copy operation serves a number of functions, which aid in reconstruction of the table. First, if the Load operation leaded data into an existing table without separately storing ("logging") the changes, a copy of the updated table is the only way to recover the updated table. Second, even if the Load operation logged changes to the table, having the copy of the updates table helps reduce the time needed for recovering the loaded table. In particular, the table may be recovered by performing the logged updates to the previous version of the table. Accordingly, the Image Copy operation is extremely useful in modern database systems.
The Image Copy operation works by making a second "pass" over the table data, the first pass being performed when the underlining data is initially located, sorted, and assembled by the Load operation itself. In the second pass, the database manager reviews the loaded table, copying each page of the completed table to the image copy. Thus, as shown in Table 1, pages of the table are copied in order from the beginning of the table to its end, each page being copied only once. The image copy is therefore structured as shown in Table 1, below.
TABLE 1 ______________________________________ Conventional Image Copy ______________________________________ page 1 page 2 page 3 page 4 page 5 . . . ______________________________________
Known Load operations wait until completion of the Load to perform an Image Copy operation, delaying the user'ability to update the data until temporarily delaying availability of the data to the user until completion of the Image Copy operation. This protects the data, preventing user access to the table until an image copy has been made. Although this arrangement has proven satisfactory in many applications, some applications may require faster access to data of loaded tables. As mentioned above, creating an image copy of the loaded table requires a second pass of the table. For some users, then, waiting until the Load and Image Copy complete may simply take too long.